<?php

namespace app\model;

use app\utils\NumText;
use think\model\concern\SoftDelete;
class AdminUser extends BaseModel
{
    use SoftDelete;
    protected $deleteTime = 'delete_at';
    protected $table = 'admin_user';
    public function getSexTextAttr($value,$data)
    {
        return NumText::sexText($data['sex']??'');
    }

    public function getStatusTextAttr($value, $data)
    {
        return NumText::statusText($data['status']??'');
    }

    public function getAvatarAttr($value, $data)
    {
        // 头像为空时，返回默认头像

        //获取当前域名
        $domain = request()->domain();

        return !empty($value)?$value : $domain.'/storage/images/avatar.png';
    }
}
